package com.sc.base.user.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.sc.commons.base.utils.except.AspectUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * @author
 */
@Aspect
@Component
public class ControllerAspect {

    @Autowired
    private ObjectMapper objectMapper;

    @Autowired
    private Environment environment;

    @Around("execution(public * com.sc.base.user.web..*Controller.*(..))")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        return AspectUtils.controllerAspect(pjp, objectMapper, environment);
    }
}
